package com.baicaoyuan.web.repository;

import com.baicaoyuan.web.model.ProjectDO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import javax.transaction.Transactional;
import java.util.List;

@Repository
public interface ProjectRepository extends JpaRepository<ProjectDO, Long> {

    List<ProjectDO> findByStatusIsNot(String status);

    @Transactional
    @Modifying
    @Query(value = "update t_project set status = ?2 where id = ?1", nativeQuery = true)
    Integer updateStatus(Long id, String status);

    @Transactional
    @Modifying
    @Query(value = "update t_project set join_jzz = ?2 where id = ?1", nativeQuery = true)
    Integer updateJoinJzz(Long id, Integer joinJzz);
}
